<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.springframework.org/schema/mvc">
<head>
    <title>Title</title>
    <script type="text/javascript" th:src="@{/jquery/jquery-3.2.1.min.js}"></script>
    <script>
        $(function () {
            $("#showBtn").click(function () {
//                $.get("image", function (data) {
//                    var str = "data:image/jpg;base64,";
//                    str = str + data;
//                    $("#img").attr("src", str);
//                    console.info(data);
//                })
                $.post("jbarcode.do", {
                    strBarCode: "1231231",
                    dimension: "0.5",
                    barHeight: "25",
                    barWith: "90"
                }, function (data) {
                    var str = "data:image/jpg;base64,";
                    str = str + data;
                    $("#img").attr("src", str);
                    console.info(data);
                });
            });
        })
    </script>
</head>
<body>
<button id="showBtn">show</button>
<img width="200" height="200" id="img"/>
</body>
</html>